#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 1e6 + 10;
struct shuxing
{
    int life, hack;
} a[N], b[N];
#define debug cout << "debug" << endl;
int main()
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i].life >> a[i].hack;
    }
    for (int i = 1; i <= m; i++)
    {
        cin >> b[i].life >> b[i].hack;
    }
    // debug
    int t1 = 1, t2 = 1;
    while (t1 <= n && t2 <= m)
    {
        int alife = a[t1].life, ahack = a[t1].hack;
        int blife = b[t2].life, bhack = b[t2].hack;
        alife -= bhack, blife -= ahack;
        a[t1].life = alife, b[t2].life = blife;
        if (alife <= 0)
        {
            t1++;
        }
        if (blife <= 0)
        {
            t2++;
        }
        if (t1 == n && t2 == m)
        {
            cout << "Fine" << endl;
            return 1;
        }
        if (t1 == n)
        {
            cout << "QAQ" << endl;
            return 1;
        }
        if (t2 == m)
        {
            cout << "Win" << endl;
            return 1;
        }
    }

    return 0;
}